package com.desitek.thunder.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Component;

import com.desitek.thunder.entity.AppUser;

@Component
public class Main {
	private IUserService userService;

	public Main() {
	}

	@Autowired
	public Main(IUserService userService) {
		this.userService = userService;
	}

	public IUserService getService(){
		
		return userService;
	}
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		AbstractApplicationContext ctx = new ClassPathXmlApplicationContext(new String[] { "applicationContext.xml" });
		Main main = (Main) ctx.getBean("main");
		
		main.getService().createUser(new  AppUser());
	}

}
